<%@ page language="java"  pageEncoding="UTF-8"%>
<%@ include file="/views/commons/taglibs.jsp"%>
<!DOCTYPE html>
<html >
<head>
	<meta charset="UTF-8">
	<title>众秀众筹</title>
	<meta name="Keywords" content="众筹，众筹网，众筹导航，众筹门户，股权众筹，众筹平台，众筹圈子人，众筹项目，众筹三方
影视众筹，店铺众筹，餐饮众筹，众筹报告，创业众筹，投后管理，项目融资，项目众筹，权力的游戏，冰与火之歌" />
	<meta name="Description" content="汇集各行业高手分析众筹项目，行业问答，众筹资讯。" />
	<meta content="IE=edge,chrome=1" http-equiv="X-UA-Compatible" />
	<meta name="renderer" content="webkit"/>
	<link rel="stylesheet" href="<%=path%>/css/bootstrap/3.3.5/css/bootstrap.min.css" />
	<link rel="stylesheet" href="<%=path%>/css/cz.css" />

	<script src="<%=path%>/js/jquery-1.11.0.min.js"></script>
	<script src="<%=path%>/css/bootstrap/3.3.5/js/bootstrap.min.js"></script>
	<script src="<%=path%>/js/plugins/layer/layer.js"></script>

	<script src="<%=path%>/js/slider.js"></script>
	<script src="<%=path%>/js/common.js"></script>
<body class="gray-bg">
<jsp:include page="/views/commons/header.jsp"></jsp:include>
<div class="layout">
	<div class="row">
		<div class="col-md-4 col-md-offset-4" style="padding:40px 0px; ">
			<div class="panel panel-default">
				<div class="panel-body">
					<h3>通过邮箱重置</h3>
					<c:choose>
						<c:when test="${result==0}">
							<form class="form reset-form-email" method="post" action="javascript:findPasswordSecond();">
		                        <fieldset>
		                            <div class="blank"></div>
		                            <div class="form-group">
										<label class="item-label">新密码：</label>
										<div class="control">
											<input type="password" class="form-control" style="width:290px" name="password" id="password" placeholder="长度6到15位，允许输入字母、_、数字">
										</div>
									</div>
									<div class="form-group">
										<label class="item-labell">确认密码：</label>
										<div class="control">
											<input type="password" class="form-control" style="width:290px" name="confirmPassword" id="confirm_password" placeholder="长度6到15位，允许输入字母、_、数字">
										</div>
									</div>
									<div class="form-group">
										<label class="item-label">验证码：</label>
										<div class="input-group">
											<input type="text"  id="image_code" name="imageCode" class="form-control" style="width:180px">
										
											<img id="imgCode" src="<%=path%>/uncheck/imageCode/find_password_second_page" height="34" alt="点击刷新验证码" onclick="javascript:refreshImage()">
										</div>
									</div>
		                            <div class="form-group">
		                                <button target-form="reset-form-email" id="find_password_btn" type="submit" class="btn btn-primary btn-block ajax-post">重置密码</button>
		                            </div>
		                        </fieldset>
		                    </form>
						</c:when>
						<c:otherwise>
							<fieldset>
	                            <div class="blank"></div>
	                            <div class="form-group">
									<label class="item-labell">消息</label>
									<div class="control">
										${msg}
									</div>
								</div>
	                        </fieldset>
						</c:otherwise>
					</c:choose>
                 </div>
            </div>
		</div>
	</div>
</div>
<jsp:include page="/views/commons/footer.jsp"></jsp:include>
</body>
<script type="text/javascript">
function findPasswordSecond(){
	$("#find_password_btn").addClass("disabled").attr("disabled","disabled").val("提交中");
	var redirectUrl="${redirectUrl}";
	$.ajax({
		url : path + "/check/findPassword/reset",
		type : "post",
		dataType : "json",
		data : {
			userPassword : $("#password").val(),
			confirmPassword:$("#confirm_password").val(),
			imageCode : $("#image_code").val()
		},
		success : function(data)
		{
			if(data.result)
			{
				if(redirectUrl != ''){
					window.location.href = redirectUrl;
				}else{
					window.location.href = path + "/";
				}
			}
			else
			{
				layer.msg(data.msg,{icon: 2});
				$("#find_password_btn").removeClass("disabled").removeAttr("disabled").val("重置密码");
			}
		},error:function(){
			layer.msg("服务器网络繁忙",{icon: 2});
			$("#find_password_btn").removeClass("disabled").removeAttr("disabled").val("重置密码");
		}
	});
}
</script>
</html>